package com.xusheng.cli.entity.frontUserModule;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.xusheng.cli.common.base.BaseEntity;
import com.xusheng.cli.common.constant.Regular;
import com.xusheng.cli.common.validation.Save;
import com.xusheng.cli.entity.vipLevelModule.VipLevel;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class FrontUser extends BaseEntity {

    private static final long serialVersionUID = -5246546100854639729L;
    /**
     * 账号
     */
    @NotNull(message = "请输入账号", groups = Save.class)
    @Pattern(regexp = Regular.MOBILE, message = Regular.MOBILE_MASSAGE, groups = Save.class)
    private String account;
    /**
     * 密码
     */
    @NotNull(message = "请输入密码", groups = Save.class)
//    @Pattern(regexp = Regular.NEWPASSWORD, message = Regular.NEW_PASSWORD_MASSAGE, groups = Save.class)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    /**
     * 头像
     */
    private String headImage;
    /**
     * 电话号
     */
    private String phone;
    /**
     * 邮箱
     */
    private String email;
    /**
     * vip编号
     */
    private Long vipId;
    /**
     * 会员到期时间
     */
    private LocalDateTime vipExpires;
    /**
     * 最后登陆时间
     */
    private LocalDateTime lastLoginTime;
    /**
     * 微信openId
     */
    @JsonIgnore
    private String openId;
    /**
     * vip等级名
     */
    @TableField(exist = false)
    private String vipName;
    /**
     * 剩余可观看电影次数
     */
    private Integer watchCount;
    /**
     * 短信验证码
     */
    @TableField(exist = false)
    private String smsCode;
    /**
     * 邀请码
     */
    private String inviteCode;
    /**
     * 邀请人的码
     */
    private String inviterCode;
    /**
     * 邀请人数
     */
    private Integer inviteNumber;
    /**
     * 金币数量
     */
    private Integer gold;
    /**
     * 今日签到
     */
    private Boolean todaySign;
    /**
     * 小视频次数
     */
    private Integer watchCountShort;
    /**
     * 推广等级
     */
    private Long promotionLevel;
    /**
     * 点击广告
     */
    private Boolean clickAd;
    /**
     * 保存二维码
     */
    private Boolean saveQrcode;
    /**
     * 保存二维码
     */
    @TableField(exist = false)
    private VipLevel vipLevel;

    private Long proxyId;
    /**
     * 域名
     */
    private String host;
    /**
     * 代理名称
     */
    @TableField(exist = false)
    private String proxyName;
    /**
     * 会员续费次数
     */
    @TableField(exist = false)
    private Integer vipCount;

    @TableField(exist = false)
    @DateTimeFormat(pattern = DatePattern.NORM_DATE_PATTERN)
    private LocalDate startTime;

    @TableField(exist = false)
    @DateTimeFormat(pattern = DatePattern.NORM_DATE_PATTERN)
    private LocalDate endTime;
}
